/// [Counting Sundays](https://projecteuler.net/problem=19)
fn main() {
    let mut week = (1 + 365) % 7;
    let mut nums = 0;
    for year in 1901..=2000 {
        let days_list = {
            if year % 400 == 0 {
                [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
            } else if year % 100 != 0 && year % 4 == 0 {
                [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
            } else {
                [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
            }
        };
        for days in &days_list {
            if week == 0 {
                nums += 1;
            }
            week = (week + days) % 7;
        }
    }
    println!(
        "The number of Sundays fell on the first of the month during the twentieth century: {}",
        nums
    );
}
